/* @(#)GSAccountExcelAction.java    V0.1
 *
 * Project: NEWGS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-5-23
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.util.ArrayList;
import java.util.HashMap;

import com.hitrust.gs.bean.GSOperatorBean;
import com.hitrust.gs.business.GSAccountProcessor;
import com.hitrust.gs.business.GSOrderDeptInfoProcessor;
import com.hitrust.gs.form.GSAccountMonthForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.vo.GSAccountMonthVO;

/**
 * 本月对帐下载
 */
public class GSAccountExcelForBusProvAction extends GSBaseAction{

    
    public String execute(GSBaseForm aForm) throws Exception {
        
        GSAccountMonthForm tForm = (GSAccountMonthForm)aForm;
        
        GSAccountMonthVO tGSAccountMonthVO=new GSAccountMonthVO();
        tGSAccountMonthVO.orderDeptId = tForm.orderDeptId;
        tGSAccountMonthVO.deliverGoodsId = tForm.deliverGoodsId;
        tGSAccountMonthVO.manufInfo = tForm.manufInfo;
        tGSAccountMonthVO.concentricityId = tForm.concentricityId;
        tGSAccountMonthVO.providerid = tForm.providerid;
        tGSAccountMonthVO.startdate = tForm.startdate;
        tGSAccountMonthVO.enddate = tForm.enddate;
        tGSAccountMonthVO.year = tForm.year;
        tGSAccountMonthVO.month = tForm.month;
        
        GSAccountProcessor tGSAccountProcessor=new GSAccountProcessor();
        
        //取得当前操作员信息
        GSOperatorBean tOperBean = (GSOperatorBean)aForm.getSession().getAttribute(GSBaseConstants.LOGIN);
        //查询当前操作员所能操作订货单位的所有送货地址
        GSOrderDeptInfoProcessor tOrderDeptProc = new GSOrderDeptInfoProcessor();
        HashMap tMap = tOrderDeptProc.getOrderDeptInfoOfOper(tOperBean.getGs_oper_org_id());
        tForm.getRequest().setAttribute("orderdept",tMap);
        //查询当前操作员所能操作的订货单位
        ArrayList tOrg = (ArrayList)tMap.get("organization");
        
        tGSAccountProcessor.exportAccountList(tGSAccountMonthVO,tOrg,tForm,tOperBean.getGs_oper_org_id(),GSBaseConstants.TYPE_PROV);
        
        aForm.getRequest().setAttribute("requery","true");
        
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
